package com.zhouu.example.core.controller;

import com.zhouu.example.core.constant.MessageConstant;
import com.zhouu.example.core.message.Result;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * 基础 Controller
 *
 * @author zhouu
 * @date 2021-02-23 23:23
 */
public class BaseController {

    protected <T> Result<T> getResult(Result<T> result) {
        return result;
    }

    protected <T> Result<T> getResult(String code, String message) {
        return new Result<>(code, message, null);
    }

    protected <T> Result<T> getResult(String code, String message, T data) {
        return new Result<>(code, message, data);
    }

    protected <T> Result<T> getDefaultResult(String code) {
        return new Result<>(code, null);
    }

    protected <T> Result<T> getSuccessResult(T data) {
        return new Result<>(MessageConstant.SYSTEM_SUCESS_CODE, data);
    }


    /*protected HttpServletRequest getRequest() {

    }*/
}
